var currentContent = 0;
var online = navigator.onLine;

function Content(title, contentString, networkContent) {
	this.title = title;
	this.getTitle = function () { return this.title; };
	this.content = contentString;
	this.getContent = function () { return this.content; };
	this.network = networkContent;
	this.getNetwork = function () { return this.network; };
}

function checkStatus() {
	return online;
}

var pageContent = new Array();
pageContent.push(new Content("About Hernández", "Hernández was born in French Camp, California, but calls Stockton, California, his hometown. His family is from La Piedad, Michoacán, with indigenous Purépecha roots. In an August 25, 2009 conversation with President Felipe Calderón of Mexico, Hernández stated that as a child, he lived half the year in La Piedad and half in the United States. As a child, Hernández worked alongside his family and other farmworkers throughout the fields of California, harvesting crops and moving from one town to another. He attended many schools and didn't learn to speak English until he was 12. Hernández was assigned to the crew of Space Shuttle mission STS-128. He also served as chief of the Materials and Processes branch of Johnson Space Center. Hernández previously developed equipment for full-field digital mammography at Lawrence Livermore National Laboratory. Hernández left NASA in 2011.",false));
pageContent.push(new Content("Youtube","<iframe width=\"560\" id=\"innerContent\" onload=\"resize();\" height=\"315\" src=\"http://www.youtube.com/embed/wao1uW4pC9c\" frameborder=\"0\" allowfullscreen></iframe>",true));
pageContent.push(new Content("Calendar in the Sky","<iframe id=\"innerContent\" onload=\"resize();\" src=\"http://www.calendarinthesky.org\"></iframe>" ,true));
pageContent.push(new Content("Map 1","<iframe id=\"innerContent\" onload=\"resize();\" src=\"http://maps.google.com/maps?f=d&amp;source=s_d&amp;saddr=University+of+Texas+at+San+Antonio,+San+Antonio,+TX&amp;daddr=Michoac%C3%A1n,+Mexico&amp;geocode=FcldwwEdxhwf-iGcvJDc2ICrtCldY42-ZmZchjGcvJDc2ICrtA%3BFbePKgEdsxPw-Sm3XLMePl8qhDHU4EvzDGXHOw&amp;aq=1&amp;oq=michoacan&amp;sll=29.477608,-98.514404&amp;sspn=0.636011,1.344452&amp;hl=en&amp;mra=ls&amp;ie=UTF8&amp;t=m&amp;ll=24.553235,-100.10491&amp;spn=10.05293,3.20812&amp;output=embed\"></iframe>" ,true));
pageContent.push(new Content("Map 2","<iframe id=\"innerContent\" onload=\"resize();\" src=\"http://maps.google.com/maps?f=d&amp;source=s_d&amp;saddr=University+of+Texas+at+San+Antonio,+San+Antonio,+TX&amp;daddr=Michoac%C3%A1n,+Mexico+to:Stockton,+CA&amp;geocode=FcldwwEdxhwf-iGcvJDc2ICrtCldY42-ZmZchjGcvJDc2ICrtA%3BFbePKgEdsxPw-Sm3XLMePl8qhDHU4EvzDGXHOw%3BFUYwQwId5D_F-CmBIUR7cw2QgDHYy08E0fV2WA&amp;aq=0&amp;oq=stockton&amp;sll=24.547123,-100.107422&amp;sspn=10.620892,21.51123&amp;hl=en&amp;mra=ls&amp;ie=UTF8&amp;ll=28.74221,-109.922195&amp;spn=18.43088,22.84269&amp;t=m&amp;output=embed\"></iframe>" ,true));

function display(index){
	if(pageContent[index].getNetwork() && !online) {
		if(index > currentContent) display(index+1);
		else display(index-1);
	} else {
		if (index >= 0 && index < pageContent.length) currentContent = index;
		document.getElementById("main").innerHTML = pageContent[currentContent].getContent();
		document.getElementById("title").innerHTML = pageContent[currentContent].getTitle();
	}
}

function resize(){
	var main = document.getElementById("main");
	var frame = document.getElementById("innerContent");
	frame.style.width = "100%";
	frame.style.height = "100%";
	frame.style.display = "block";
}